import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'

Vue.use(Vuex)

const state = {
  title: '主页',
  isActive: '',
  isLogin: false,
  milliseconds: 0
}
const mutations = {
  // 记录标签title
  onTitle (state, title) {
    state.title = title
  },
  // 记录选项卡
  onActive (state, text) {
    state.isActive = text
  },
  // 改变登录状态
  changeLogin (state, isLogin) {
    state.isLogin = isLogin
  }
}
const actions = {

}

export default new Vuex.Store({
  state,
  mutations,
  actions,
  plugins: [createPersistedState()]
})
